package com.wejoy.video.middle.station.data.enums.dict;

import com.wejoy.video.middle.station.data.exception.BusinessException;

/**
 * 全局内容类型操作
 *
 * @author admin
 */
public enum EnumGlobalContentAction {
    SWITCH_TAB(0, "跳转到底部工具栏某个界面", "zt://switchtab"),
    OPEN_ROUTER(1, "打开某个界面", "zt://openrouter"),
    OPEN_MP(1, "打开小程序", "zt://openminiprogram"),
    ;

    private Integer code;
    private String text;
    private String url;

    EnumGlobalContentAction(Integer code, String text, String url) {
        this.code = code;
        this.text = text;
        this.url = url;
    }

    public static EnumGlobalContentAction getByCode(Integer code) {
        if (null == code) {
            return null;
        }
        for (EnumGlobalContentAction type : EnumGlobalContentAction.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new BusinessException("内容类型非法");
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}
